<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>${title}</title>
	<link rel="stylesheet" type="text/css" href="<c:url value='/resource/css/common.css'/>"/>
	<script type="text/javascript" src="<c:url value='/resource/js/jquery-1.7.2.min.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/resource/artdialog/artdialog.js?skin=${sys_theme}'/>"></script>
	<script type="text/javascript" src="<c:url value='/resource/artdialog/iframetools.js'/>"></script>
	<script type="text/javascript">
	var ctxPath = "<%=path%>";
	$(function() {
		// 界面初始化
		$("#tbl_datalist tr:even").css({
			"background-color" : "#f2f7fd"
		});
		var _tmp_bg = "#fff";
		var _height =parseInt($("#tbl_container").css("height").substr(0,$("#tbl_container").css("height").indexOf("px")));
		//把当前table数据高度传回给父页面改变iframe高度
		window.parent.chageHeight(_height+90);
		
		$("#tbl_container").css("width",$(parent.window).width()-10);
		
		$("#tbl_datalist tr").hover(function() {
			_tmp_bg = $(this).css("background-color");
			$(this).css("background-color", "#cce3c7");
		}, function() {
			$(this).css("background-color", _tmp_bg);
		});
	});
	
	// 界面初始化
	function initView() {
		var _tbl_h = $(window).height() - 100;
		if ($.browser.msie && ($.browser.version == "6.0")) {
			_tbl_h -= 10;
		}
	}
 	//分页 跳转
 	function _goto(pageIndex) {
	 var _url = "/sacw/caseGoods/profile/homePage/@.html".replace("@", pageIndex);
	$("#query_form").attr("action",_url);
	$("#query_form").submit();
	}
 	
 	//判断是否钻取下一级单位  0或者1 0 可用 1不可用
 	function isGoTo(code)
 	{	
 		//获取是否能取得下一级单位
 		var ischose="${ischose}";
 		//统计类型  单位统计才能执行转取下一级单位
 		var type="${type}";
 		if(type=="dwtj")
 		{	
 			if(ischose==0)
			{
 				$("#dept").val(code);
 	 	 		_goto(1);
			}
 		}
 	}
 	function gotoDwTj()
 	{
 		$("#type").val("dwtj");
 		$("#dept").val("");
 		_goto(1);
 	}
 	
 	
 	function gotoWpTj()
 	{
 		$("#type").val("wptj");
 		$("#dept").val("");
 		_goto(1) ;
 	}
 	
	</script>
	<style type="text/css">
		#div1,#div2 {position:absolute;left: 0px;float: left;height: 300px;}
		.showImage{float: left;height: 300px;;}																
		.myChose a{margin:0px;width:110px;height:30px; line-height: 30px;display:inline-block;background-color:#EEEEEE;border:1px solid #CCCCCC;color:#444444;text-align: center;}
		.myChose a:hover{background-color:#77C2EF;color:#5E4122;border:1px solid #CCCCCC;text-align: center;}
	</style>
  </head>
  <body>
    <div id="tbl_container" style="font-size:12px;float: left;" class="myChose">
				<!-- 判断登陆的用户权限  是否显示涉案物品单位-->
  				<a href="javascript:gotoDwTj();" id="dwtj"  <c:if test="${type=='dwtj'}">style="background-color:#77C2EF;"</c:if> 
  					<c:forEach var="role" items="${roles}">
  						<c:if test="${role.rcode==1}">style="display:none"</c:if>
  						<c:if test="${role.rcode==2}">style="display:none"</c:if>
  					</c:forEach>
  				>涉案物品单位统计</a>
  				<!-- 判断是否被选中的状态  背景颜色改变 -->
  				<a href="javascript:gotoWpTj()" id="wptj" <c:if test="${type=='wptj'}">style="background-color:#77C2EF"</c:if> >涉案物品类型统计</a>
  				<form id="query_form"  method="post">
  				<!-- 传到后台判断 物品统计或单位统计 -->
  					<input type="hidden" value="${type}" id="type" name="type"></input>
  				<!-- 砖取下一级部门的deptid -->
  					<input type="hidden" value="${deptId}" id="dept" name="deptid">
  				</form>
	   		<table id="tbl_datalist" class="tbl_datalist" cellpadding="0" cellspacing="0" style="font-size: 12px;table-layout: fixed;" border="0">
	   			<thead>
		   			<tr>
		   				<th  width="55" style="text-align: left">序号</th>
		   				<th style="text-align: left;" width="180" >
		   					<c:if test="${type=='dwtj'}">单位名称</c:if>
		   					<c:if test="${type=='wptj'}">物品类型</c:if>		   					
		   				</th>
		   				<th width="90" style="text-align: left" >入库未标注</th>
		   				<th width="90" style="text-align: left" >出库未标注</th>
		   				<th width="90" style="text-align: left" >临时出库</th>
		   				<th width="90" style="text-align: left" >逾期未归还</th>
		   				<th width="50" style="text-align: left" >在库</th>
		   				<th width="90" style="text-align: left" >暂时保管在库</th>
		   			</tr>
	   			</thead>
	   					
	   				<c:forEach var="data" items="${page.list}" varStatus="vs">
	   				<tr style="text-align: center;">
	   					<td>${((page.pageIndex-1)*page.pageSize)+vs.count}</td>
	   					<td  onclick="isGoTo('${data.code}')" 	<c:if test="${ischose==0&&type=='dwtj'}">style="cursor: pointer;"</c:if>>${data.tjlx}</td>
	   					<td>${data.rkwbz}</td>
	   					<td>${data.ckwbz}</td>
	   					<td>${data.lsck}</td>
	   					<td>${data.yqwgh}</td>
	   					<td>${data.zk}</td>
	   					<td>${data.zsbgzk}</td>
	   					<c:set var="num" value="${((page.pageIndex-1)*page.pageSize)+vs.count}"></c:set>
	   					<c:set var="sum1" value="${sum1+(data.rkwbz)}"></c:set>
	   					<c:set var="sum2" value="${sum2+(data.ckwbz)}"></c:set>
	   					<c:set var="sum3" value="${sum3+(data.lsck)}"></c:set>
	   					<c:set var="sum4" value="${sum4+(data.yqwgh)}"></c:set>
	   					<c:set var="sum5" value="${sum5+(data.zk)}"></c:set>
	   					<c:set var="sum6" value="${sum6+(data.zsbgzk)}"></c:set>
	   				</tr>
	   				</c:forEach>
	   				<c:if test="${type=='dwtj'}">
	   					<td>${num+1}</td>
	   					<td>合计</td>
	   					<td>${sum1}</td>
	   					<td>${sum2}</td>
	   					<td>${sum3}</td>
	   					<td>${sum4}</td>
	   					<td>${sum5}</td>
	   					<td>${sum6}</td>
	   				</c:if>
	   		</table>
		</div>
   		<div style="clear:both;margin-bottom: 10px;"></div>
   		<c:if test="${type=='wptj'}">
   			<jsp:include page="/common/pager.jsp"/>
   		</c:if>
  </body>
</html>
